﻿using Product.Domain.Entity;
using Product.Domain.Repository;
using Product.EntityFrameworkCore.PO;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
namespace Product.EntityFrameworkCore.Repository
{
    public class SpuReposiory : ISpuReposiory
    {
        private readonly ProductContext _productContext;
        private readonly IMapper _mapper;

        public SpuReposiory(ProductContext productContext, IMapper mapper)
        {
            this._productContext = productContext;
            _mapper = mapper;
        }

        public async Task AddSpu(Spu spu)
        {         
           var spuPo= _mapper.Map<SpuPo>(spu);
           await _productContext.Spu.AddAsync(spuPo);
        }
    }
}
